package io.yuncheng.modules.sys;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import io.yuncheng.modules.sys.entity.AgentArithmeticStepEntity;

import java.util.Collections;
import java.util.List;

public class Test {
    public static void main(String args[]) {
        String str = "[{\"stepAlgo\":\"SM2\",\"stepContent\":\"content\",\"stepHost\":\"Sig\",\"stepId\":3,\"stepResult\":\"Success\",\"stepTimeSpan\":1},{\"stepAlgo\":\"SM2\",\"stepContent\":\"content\",\"stepHost\":\"Sig\",\"stepId\":2,\"stepResult\":\"Success\",\"stepTimeSpan\":9}]";
        List<AgentArithmeticStepEntity> agentArithmeticStepEntities = JSON.parseObject(str, new TypeReference<List<AgentArithmeticStepEntity>>() {
        });
        Collections.sort(agentArithmeticStepEntities,(a1,a2)->a1.getStepId()-a2.getStepId());
        for (AgentArithmeticStepEntity agentArithmeticStepEntity : agentArithmeticStepEntities) {
            System.out.println(agentArithmeticStepEntity.getStepId());
        }

    }

}
